import request from '@/config/axios'

// 回收记录 VO
export interface ReclaimHistoryVO {
  id: number // ID
  productName: string // 商品名称
  specification: string // 规格名称
  pice: number // 价格
  number: number // 回收数量
  userName: string // 姓名
  userId: number // 用户id
  phone: number // 手机号
  status: number // 是否赠送优惠劵
}

// 回收记录 API
export const ReclaimHistoryApi = {
  // 查询回收记录分页
  getReclaimHistoryPage: async (params: any) => {
    return await request.get({ url: `/promotion/reclaim-history/page`, params })
  },

  // 查询回收记录详情
  getReclaimHistory: async (id: number) => {
    return await request.get({ url: `/promotion/reclaim-history/get?id=` + id })
  },

  // 新增回收记录
  createReclaimHistory: async (data: ReclaimHistoryVO) => {
    return await request.post({ url: `/promotion/reclaim-history/create`, data })
  },

  // 修改回收记录
  updateReclaimHistory: async (data: ReclaimHistoryVO) => {
    return await request.put({ url: `/promotion/reclaim-history/update`, data })
  },

  // 删除回收记录
  deleteReclaimHistory: async (id: number) => {
    return await request.delete({ url: `/promotion/reclaim-history/delete?id=` + id })
  },

  // 导出回收记录 Excel
  exportReclaimHistory: async (params) => {
    return await request.download({ url: `/promotion/reclaim-history/export-excel`, params })
  },
}